<?php

if (!defined('__ADMIN_DIR__')) {
	define('__ADMIN_DIR__', dirname(__FILE__));
}

if(!is_file(__ADMIN_DIR__ . '/../config.inc.php') && is_file(__ADMIN_DIR__ . '/../install/index.php')) {
	header('Location: ../install/index.php');
}

require_once __ADMIN_DIR__ . '/../config.inc.php';

Tinyask_App::app('Tinyask_User')->to($user);
Tinyask_App::app('App_Notice')->to($notice);

/** 检测版本是否升级 **/
list($software, $currentVersion) = explode(' ', $config->version);
if($user->access('founder', true)) {
	$mustUpgrade = (!defined('Tinyask_Common::VERSION') || version_compare(str_replace('/', '.', Tinyask_Common::VERSION ), str_replace('/', '.', $currentVersion), '>'));

	if($mustUpgrade) {
		Tinyask_Response::redirect(Tinyask_Common::url('upgrade.php', $config->adminUrl));
	}
}
